package leetcode.other.p977;

import java.util.Arrays;

/**
 * 977. 有序数组的平方
 */
class Solution2 {
    public int[] sortedSquares(int[] nums) {
        for (int i = 0; i < nums.length; i++) {
            nums[i] = nums[i] * nums[i];
        }
        Arrays.sort(nums);
        return nums;
    }

    public static void main(String[] args) {
        System.out.println(Arrays.toString(new Solution2().sortedSquares(new int[]{-4,-1,0,3,10})));
        System.out.println(Arrays.toString(new Solution2().sortedSquares(new int[]{-7,-3,2,3,11})));
    }
}